package com.plian.system.dao.fr.annualreport;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.dao.DaoSupport;
import com.plian.system.model.page.Page;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class AnnualReportDao {

    @Resource(name = "daoSupport")
    private DaoSupport dao;

    /**
     * 新增
     *
     * @param pd
     * @throws Exception
     */
    public void save(PageData pd) throws Exception {
        dao.save("AnnualReportMapper.save", pd);
    }
    /**
     * 删除
     *
     * @param
     * @throws Exception
     */
    public void delete(PageData pd) throws Exception {
        dao.delete("AnnualReportMapper.delete", pd);
    }

    /*获取数据*/
    public PageData findById(PageData pd) throws Exception {
        return (PageData) dao.findForObject("AnnualReportMapper.findById", pd);
    }

    public PageData findByDate(PageData pd) throws Exception {
        return (PageData) dao.findForObject("AnnualReportMapper.findByDate", pd);
    }
    public PageData findSumByDate(PageData pd) throws Exception {
        return (PageData) dao.findForObject("AnnualReportMapper.findSumByDate", pd);
    }
    public List<PageData> list(Page page) throws Exception {
        return (List<PageData>) dao.findForList("AnnualReportMapper.datalistPage", page);
    }
    public List<PageData> listByCondition(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AnnualReportMapper.listByCondition", pd);
    }
    public List<PageData> getFinancialDate(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AnnualReportMapper.getFinancialDate", pd);
    }
    public List<PageData> getGorupFinancialDate(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AnnualReportMapper.getGorupFinancialDate", pd);
    }
    /**
     * 批量删除
     *
     * @param ids
     * @throws Exception
     */
    public void deleteAll(List<String> ids) throws Exception {
        dao.delete("AnnualReportMapper.deleteAll", ids);
    }

    /*
上报
*/
    public void refer(PageData pd) throws Exception {
        dao.update("AnnualReportMapper.refer", pd);
    }
    public void edit(PageData pd) throws Exception {
        dao.update("AnnualReportMapper.edit", pd);
    }
    public List<PageData> findByIds(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AnnualReportMapper.findByIds", pd);
    }
    /**
     * 根据年份查找年报数据
     */
    public List<PageData> findByYear(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AnnualReportMapper.findByYear", pd);
    }
}
